package com.nhncorp.pleiades.protocol;

import java.io.IOException;

import com.nhncorp.pleiades.hadoop.VersionedProtocol;
import com.nhncorp.pleiades.persistence.LockStatus;

public interface LockServiceProtocol extends VersionedProtocol {
  
  public static final long versionID = 1L;

  public boolean tryLock(ClientLockInfo lockInfo) throws IOException;
  
  public String lock(ClientLockInfo lockInfo) throws IOException;
  
  public String unlock(ClientLockInfo lockInfo) throws IOException;
  
  public LockStatus getLockStatus(String path) throws IOException;
  
  public boolean lockExist (String path) throws IOException;
  
  public LockStatus[] listLock (String path) throws IOException;
  
  public boolean releaseAllLocks(String owner) throws IOException;
  
  public boolean isLockManagerReady() throws IOException;
  
  public boolean createNode(LockMetaData metaData, boolean overWrite, boolean isDirectory) throws IOException;
  
  public boolean deleteNode(ClientLockInfo lockInfo, boolean recursive) throws IOException;
  
  public boolean nodeExist(String path) throws IOException;
  
  public LockMetaData getMetaData(String path) throws IOException;
  
  public LockMetaData[] readDir(String path, boolean includeDirectory) throws IOException;
  
  public String getContents(ClientLockInfo lockInfo) throws IOException;
  
  public boolean setContents(ClientLockInfo lockInfo, String contents) throws IOException;
  
  public String getMasterPleiades() throws IOException;
  
  public String[] getSlavePleiades() throws IOException;
  
  public String getMasterEventManager() throws IOException;
  
  public String[] getSlaveEventManager() throws IOException;
  
  public String getServiceId(String serviceName) throws IOException;
  
  public PleiadesInfoData getPleiadesInfo() throws IOException;
  
  public String getLockDump() throws IOException;
  
  public boolean isPrimaryMaster() throws IOException;

}
